package cn.hello1023.springbootlabs.controller;

import cn.hello1023.springbootlabs.service.UserService;
import cn.hello1023.springbootlabs.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {
    @Autowired
    UserService userService;

    @GetMapping("/getUserList")
    public void getUser() {
        List<User> list = userService.getUserList();
        for (User user :list ){
            System.out.println(user.toString());
        }
    }
    @GetMapping("/getUserList2")
    public List<User> getUser2() {
        List<User> list = userService.getUserList();
        return list;
    }

}
